<?
        $results = array();
        require_once('../inc/usertypefunc.php');
		$action = isset($_POST['action']) ? $_POST['action'] : "";
		if($action=='create'){
			$row=$_POST;
			$results = CreateUsertype($row);
			if($results === true){
				header("Location: index.php");
				die();
			}	
	        else{
					//header("Location: index.php");
	        }
		}
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Create Usertype</title>
    <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css">
    <style type="text/css">
        .error { color: red; }
        body { margin:20px; }
    </style>
</head>

<body>
	
	<dl class="error">
    		<? foreach ($results as $key => $value): ?>
    			<dt><?=$key?></dt>
    			<dd><?=$value?></dd>        		
    		<? endforeach; ?>
    	</dl>
                
        <form class="form-horizontal" method="post" action="">
                    
                <label for="created_at">Created at:</label>
                    <input type="datetime" name="created_at" id="created_at"  />
            
            	<label for="updated_at">Updated at:</label>
                    <input type="datetime" name="updated_at" id="updated_at"  />
                    
                <label for="usertype">Usertype:</label>
                    <input type="text" name="usertype" id="usertype"  />

			<input type='hidden' name='action' value='create' />
            <input class="btn btn-primary" type="submit" value="Create new usertype." />
        </form>
        
        <a href="index.php">Index</a>

</body>
</html>